package com.elinkway.infinitemovies.async;

import android.content.Context;

import com.elinkway.infinitemovies.bean.SingleInfo;
import com.elinkway.infinitemovies.http.api.MoviesHttpApi;
import com.elinkway.infinitemovies.http.parser.SingleInfoParser;
import com.lvideo.http.bean.LVideoDataHull;

public class RequestSingleInfoTask extends MoviesHttpAsyncTask<SingleInfo> {

    private String mglobalVid;

    private String mSite;
    
    private String msrc;

    private RequestResultListener<SingleInfo> mListener;

    public RequestSingleInfoTask(Context context) {
        super(context);
    }

    @Override
    public LVideoDataHull<SingleInfo> doInBackground() {
        return MoviesHttpApi.requestSingleInfo(new SingleInfoParser(), mglobalVid, mSite,msrc);
    }

    @Override
    public void onPostExecute(int updateId, SingleInfo result) {
        if (null != mListener) {
            mListener.onRequestSuccess(updateId, result);
        }
    }

    @Override
    public void netNull() {
        super.netNull();
        if (null != mListener) {
            mListener.onRequestFailed();
        }
    }

    @Override
    public void netErr(int updateId, String errMsg) {
        super.netErr(updateId, errMsg);
        if (null != mListener) {
            mListener.onRequestFailed();
        }
    }

    @Override
    public void dataNull(int updateId, String errMsg) {
        super.dataNull(updateId, errMsg);
        if (null != mListener) {
            mListener.onRequestFailed();
        }
    }

    public RequestResultListener<SingleInfo> getmListener() {
        return mListener;
    }

    public void setmListener(RequestResultListener<SingleInfo> mListener) {
        this.mListener = mListener;
    }

    public String getMglobalVid() {
        return mglobalVid;
    }

    public void setMglobalVid(String mglobalVid) {
        this.mglobalVid = mglobalVid;
    }

    public String getmSite() {
        return mSite;
    }

    public void setmSite(String mSite) {
        this.mSite = mSite;
    }
    
    public String getMsrc() {
        return msrc;
    }

    public void setMsrc(String msrc) {
        this.msrc = msrc;
    }
}
